public class Animal {
    private String name;
    public Animal(){

    }

    public Animal(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void eat(){
        System.out.println(getName()+"吃东西");
    }
    public void sleep(){
        System.out.println(getName()+"睡觉");
    }
}
class TestAnimal{
    public static void main(String[] args) {
       Rabbit m=new Rabbit("兔子");
        Tiger n=new Tiger("老虎");
        m.eat();
        m.sleep();
        n.eat();
        n.sleep();
    }
}
